home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / comm / tcp / rxsocket.lha / rxsocket / examples / pf.rexx < prev    next >
OS/2 REXX Batch file  |  2000-11-28  |  760b  |  33 lines

  1. /* shows how to use rxlibnet miami packet filter support */
  2. /* press ctrl-c to stop it                               */
  3.  
  4. l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
  5. if AddLibrary("rexxsupport.library","rxsocket.library","rxlibnet.library")~=0 then exit
  6.  
  7. if ~open("STDERR","CONSOLE:","W") then stderr="STDOUT"
  8. if ~RMH_ReadArgs("INTERFACE/A") then do
  9.     call PrintFault()
  10.     exit
  11. end
  12.  
  13. prg=ProgramName("NOEXT")
  14.  
  15. s=2**allocsignal()
  16. pf=MiamiCreatePF(parm.0.value,s)
  17. if pf<0 then do
  18.     call writeln(stderr,prg": cant' add a filter to '"parm.0.value"'")
  19.     exit
  20. end
  21.  
  22. call closerxsocket()
  23. do while 1
  24.     rs = wait(or(s,2**12))
  25.     if and(rs,s)~=0 then do
  26.         p=MiamiPFNext(pf)
  27.         say length(p)
  28.         if p~="" then say c2x(p)
  29.         else say "<empty>"
  30.     end
  31.     else exit
  32. end
  33.